package main

import "fmt"

//func main() {
//	birth := time.Date(2021,3,11,0,0,0,0,time.Local)
//	fmt.Println(birth)
//	now := time.Now()
//	fmt.Println(now)
//
//	var age int
//	age = now.Year() - birth.Year()
//	if now.Month() < birth.Month() {
//		age--
//	}else if now.Month() == birth.Month() {
//		if now.Day() < birth.Day(){
//			age--
//		}
//	}
//	fmt.Println(age)
//}

func main() {
	nums := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
	//fmt.Println(nums)
	//rotate(nums,4)

	// 在函数里修改输入数组对于调用者是可见的。
	// 根据你的函数返回的长度, 它会打印出数组中 该长度范围内 的所有元素。
	//for i:=0;i<n;i++{
	//	fmt.Pr(nums[i])
	//}intc
	fmt.Println(Test(3, 0, nums))

}

func Test(m int, s int, people []int) []int {
	//if len(people) < m {
	// return people
	//}

	var n = m - 1
	for i := s; i < len(people); i++ {
		if i == n {
			if i == len(people) {
				people = append(people[:i])
				continue
			}
			people = append(people[:i], people[i+1:]...)
			n = n + m - 1
			if n > len(people) {
				s = n - len(people)
			}
		}

	}

	if len(people) > m {
		return Test(m, s, people)
	}

	return people
}
